import request from '@/utils/request'
import downloader from '@/utils/downloader'
import { HttpResponse } from '@/utils/request.ts'; // 确保 HttpResponse 的路径正确
//系统用户分页列表
export function adminUserList(data) {
	return request({
		url: '/admin/user/teacher/teacherList',
		method: 'get',
		params: data
	})
}

//获取系统用户信息
// export function adminUserInfo(data) {
// 	return request({
// 		url: '/admin/user/adminUser/adminUserInfo',
// 		method: 'get',
// 		params: data
// 	})
// }
// export function adminUserInfon(data): Promise<HttpResponse> {
// 	console.log('走了假的获取用户信息接口');
	
//     return new Promise((resolve, reject) => {
//         // 模拟 API 调用延迟
//         setTimeout(() => {
//             if (data) {
//                 // 模拟登录成功并存储 token
//                 localStorage.setItem('token', 'fake-token');

//                 // 返回成功的响应
//                 resolve({
//                     status: 200,
//                     code: 200,
//                     message: '登录成功',
//                     data: {} // 这里可以填充更多的用户信息或其他数据
//                 });
//             } else {
//                 // 返回失败的响应
//                 reject({
//                     status: 400,
//                     code: 400,
//                     message: '无效的凭据',
//                     data: {}
//                 });
//             }
//         }, 1000);
//     });
// }
export function adminUserInfo(data) {
	return request({
		url: '/admin/user/teacherInfo',
		method: 'get',
		params: data
	})
}
//添加系统用户
export function adminUserSave(data) {
	return request({
		url: '/admin/user/teacher/teacherSave',
		method: 'post',
		data
	})
}

//修改系统用户
export function adminUserUpdate(data) {
	return request({
		url: '/admin/user/teacher/teacherUpdate',
		method: 'post',
		data
	})
}

//重置系统用户密码
export function resetPassword(data) {
	return request({
		url: '/admin/user/teacher/resetPassword',
		method: 'PUT',
		params: data
	})
}

//删除系统用户
export function adminUserRemove(data) {
	return request({
		url: '/admin/user/teacher/teacherRemove',
		method: 'DELETE',
		params: data
	})
}

//批量导入系统用户
export function importAdminUser(data) {
	return request({
		url: '/admin/user/teacher/importTeacher',
		method: 'post',
		data
	})
}

//导出系统用户
export function adminUserExport(data) {
	return downloader({
		url: '/admin/user/teacher/teacherExport',
		method: 'get',
		params: data
	})
}

//修改用户密码
export function updatePassword(data) {
	return request({
		url: '/admin/user/adminUser/updatePassword',
		method: 'post',
		params: data
	})
}

//下载模板
export function downloadTemplate(data) {
	return downloader({
		url: '/admin/user/teacher/downloadTemplate',
		method: 'get',
		params: data
	})
}

//上传文件-共用
export function uploadFile(data) {
	return request({
		url: '/admin/user/adminUser/uploadFile',
		method: 'post',
		data
	})
}

//获取用户名是否存在
export function selectUsernameIsExist(data) {
	return request({
		url: '/admin/user/adminUser/selectUsernameIsExist',
		method: 'get',
		params: data
	})
}

//用户解锁-可批量
export function unlockUserBatch(data) {
	return request({
		url: '/admin/user/adminUser/unlockUserBatch',
		method: 'post',
		params: data
	})
}

//获取当前用户部门下用户
export function adminUserListByDeptId(data) {
	return request({
		url: '/admin/user/adminUser/adminUserListByDeptId',
		method: 'get',
		params: data
	})
}


//查询
export function majorInfoList(data) {
	return request({
		url: '/admin/user/adminUser/adminUserMajorList',
		method: 'get',
		params: data
	})
}
